#include <bits/stdc++.h>
using namespace std;
const int N = 5005;

int n, m, p;
int fa[N];
int a, b;
int find(int x)
{
    if (fa[x] == x)
        return x;
    else
        fa[x] = find(fa[x]);
    return fa[x];
}
int main()
{
    scanf("%d%d%d", &n, &m, &p);
    for (int i = 1; i <= n; i++)
    {
        fa[i] = i;
    }
    for (int i = 0; i < m; i++)
    {
        scanf("%d%d", &a, &b);
        fa[find(a)] = find(b);
    }
    for (int i = 0; i < p; i++)
    {
        scanf("%d%d", &a, &b);
        if (find(a) == find(b))
        {
            printf("Yes\n");
        }
        else
        {
            printf("No\n");
        }
    }
    return 0;
}